//
// Created by 吴喆 on 2020/3/5.
//

#ifndef SUMMER_SCENE_H
#define SUMMER_SCENE_H

#import <vector>

#import "GameObject.h"
#import "Animation.h"
#import "World.h"
#import "Map.h"
#import "Camera.h"
#import "CollisionListener.h"


class GameObject;

class Renderer;

class Texture2D;

class Player;

/**
 * 场景
 */
class Scene {
public:
    explicit Scene();

    virtual ~Scene();

    virtual void update();

    virtual void render();

    virtual void init();

    virtual void initRenderer() = 0;

    // 初始化场景背景
    virtual void initBackground() = 0;

    // 初始化地图
    virtual void initMap();

    // 初始化玩家
    virtual void initPlayer() = 0;

    // 初始化摄像头
    virtual void initCamera();

    World *world = nullptr;
protected:
    Map *map;
    Camera *camera;
public:
    Camera *getCamera() const;

protected:
    Player* player;
    std::vector<GameObject *> gameObjects;
    Animation backgroundAnimation = Animation(200);
    Texture2D *currentFrame;
    Renderer *spriteRenderer;
    Renderer *backgroundRenderer;
    virtual void renderBackground(Renderer &renderer) = 0;
private:
    CollisionListener *collisionListener;
};


#endif //SUMMER_SCENE_H
